﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using FluentNHibernate.Mapping;

namespace Barry.BarbeSystem.Models
{

    /// <summary>
    ///消费记录
    /// </summary>
    public class ConsumeHistory
    {
        public virtual int Id { set; get; }

        public virtual Member Member { set; get; }

        [Display(Name = "余额（元）")]
        public virtual decimal Balance { set; get; }

        [Display(Name = "金额变动（元）")]
        public virtual decimal ConsumeAmount { set; get; }

        public virtual Employee Employee { set; get; }

        [Display(Name = "备注")]
        public virtual string Remarks { set; get; }

        [Display(Name = "消费详情")]
        public virtual string ConsumeDetail { set; get; }

        [Display(Name = "日期")]
        public virtual DateTime CurrentDate { set; get; }


      
    }


    public class ConsumeHistoryMap: ClassMap<ConsumeHistory>
    {
        public ConsumeHistoryMap()
        {
            Id(i => i.Id);
            References<Member>(i => i.Member);
            Map(i => i.Balance).Not.Nullable().Precision(8).Scale(2);
            Map(i => i.ConsumeAmount).Precision(8).Scale(2).Not.Nullable();
            References<Employee>(i => i.Employee);
      
            Map(i => i.Remarks).Length(4000);
            Map(i => i.CurrentDate).Not.Nullable();
            Map(i => i.ConsumeDetail).Length(4000);

        }
    }
}